<template>
  <div class></div>
</template>
<script>
import axios from "@/utils/requestdp";
import dayjs from "dayjs";

export default {
  name: "APIdatatablewarn",
  components: {},
  data() {
    return {};
  },
  computed: {
    ishistory: function () {
      return this.$store.state.daping.ishistorytime;
    },
    timerangarr: function () {
      return this.$store.state.daping.timepick;
    },
  },
  watch: {},
  mounted() {
    this.watchEvent();
  },
  methods: {
    watchEvent() {
      //先清除定时任务
      if (
        this.$store.state.daping.intervalArr["APIdatatablewarn"] !=
        undefined
      ) {
        return;
      }

      this.loadData();
      let interval = setInterval(() => {
        this.loadData();
      }, this.$root.setting.data.interval);
      this.$store.state.daping.intervalArr["APIdatatablewarn"] = [
        { interval: interval },
      ];
    },
    loadData() {
      // let day = dayjs().format("YYYY-MM-DD");

      axios.post("/warn/msg/list?pageNum=1&pageSize=30",{}).then((res) => {
        if (true) {
          //如果有则获取200中的结果
          // console.log(res);
          this.$store.state.daping.datatablewarnbeijing = res.rows
        }
      });
    },
  },
};
</script>
<style lang='scss' scoped>
</style>